package com.internship.service;


import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.internship.dao.NotifyDao;
import com.internship.model.Notify;
import com.internship.page.Page;

@Service
public class NotifyService {
	private final int PAGE_SIZE = 10;
	@Autowired
	private NotifyDao notifyDao;

	public Notify getNotifyById(int id) {
		return notifyDao.getNotifyById(id);
	}
	public Page<Notify> getNotifyList(String title,int toId,int pageNumber) {
		Page<Notify> page = new Page<Notify>(pageNumber, PAGE_SIZE);
		List<Notify> list = notifyDao.getNotifyList(title,toId, page);
		page.setResultList(list);
		return page;
	}
	public int addNotify(Notify notify) {
		return notifyDao.addNotify(notify);
		
	}
	public int updateNotify(Notify notify) {
		return notifyDao.updateNotify(notify);
		
	}
	public int delNotify(int id) {
		return notifyDao.delNotify(id);
	}
	public int getNotifyCount(int toId) {
		return notifyDao.getNotifyCount(toId);
	}
}
